package com.slz3.business.module.socialManagement.socSign.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.socialManagement.socSign.domain.SocSign;
import com.slz3.business.module.socialManagement.socSign.domain.SocSignCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class SocSignResController {

    @Resource
    private  SocSignResAtomic socSignResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, SocSign socSign) {
        if (SocSignResUnsafeValid.add(req, socSign)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.add_$SocSignUpdateLock(req, socSign);
        }
    }

    public final Mono<ServerResponse> delete(ServerRequest req, SocSignCondition socSignCondition) {
        if (SocSignResUnsafeValid.delete(req, socSignCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.delete_$SocSignUpdateLock(req, socSignCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, SocSign socSign) {
        if (SocSignResUnsafeValid.modify(req, socSign)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.modify_$SocSignUpdateLock(req, socSign);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (SocSignResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return SocSignResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
        if (SocSignResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.info_$SocSignUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (SocSignResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return SocSignResExecutor.choice(req);
        }
    }

    public final Mono<ServerResponse> auditSubmit(ServerRequest req, SocSignCondition socSignCondition) {
        //
        if (SocSignResUnsafeValid.auditSubmit(req, socSignCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.auditSubmit_$SocSignUpdateLock(req, socSignCondition);
        }
    }

    public final Mono<ServerResponse> audit(ServerRequest req, SocSignCondition socSignCondition) {
        if (SocSignResUnsafeValid.audit(req, socSignCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.audit_$SocSignUpdateLock(req, socSignCondition);
        }
    }

    public final Mono<ServerResponse> auditReject(ServerRequest req, SocSignCondition socSignCondition) {
        if (SocSignResUnsafeValid.auditReject(req, socSignCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.auditReject_$SocSignUpdateLock(req, socSignCondition);
        }
    }

    public final Mono<ServerResponse> usingEnable(ServerRequest req, SocSignCondition socSignCondition) {
        if (SocSignResUnsafeValid.usingEnable(req, socSignCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.usingEnable_$SocSignUpdateLock(req, socSignCondition);
        }
    }

    public final Mono<ServerResponse> usingDisable(ServerRequest req, SocSignCondition socSignCondition) {
        if (SocSignResUnsafeValid.usingDisable(req, socSignCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return socSignResAtomic.usingDisable_$SocSignUpdateLock(req, socSignCondition);
        }
    }

}
